-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Add Feature discovery API endpoint and plugin interface #1630
Conversation
Implement features API endpoint.
getFeatures() registerFeature() - for plugins implementing an v2 API definition.
to server-api
@godind does this PR address feature discovery requirements for KIP? |
You read minds! When we briefly talked about it, that was my first thought - we need something public. It's just enough to know to block features and inform users. Brilliant! |
@tkurki Given this is more server related I am wondering whether feature discovery is better placed under the |
Detect plugin features via the `feature` attribute.
@tkurki I have updated the PR so now:
With regards to plugins implementing APIs, currently the API Proposed API list is (as these have at least been implemented to some extent already or under construction): |
Apologies for being so inactive here. I've been mulling this over in the background. Some thoughts:
It may very well be that I just haven't bumped into the use cases for this API - could you elaborate a little more here? It is also a good idea to think about the API client: are we talking about webapps, other plugins or use from some other system? My point above about just probing the API holds for webapps. but not plugins. But then again we don't have a way for plugins to use OpenApi apis, so what can a plugin do with the information that the system has History API if it can not use the API? A practical example could be polar calculations, that could use historical data if it were available and a standard API would allow using any implementation backed by some database. I'll promise to find the time to continue this conversation more actively. Again, apologies for the silence. PS. I'll submit a bunch of individual review comments, apparently i started a review and never sent it earlier. |
The Signal K server already knows what is available, so why not just ask it?
I think we need to land on how Signal K defined APIs should be implemeted by plugins. Clearly there are several approaches but I personally lean towards the API definition and route handling being done by the server and passed through to a registered plugin (much like the approach taken for resources and autopilot). A good test case for options is an Anchor API.... there is already a plugin that has the required functionality but it lacks an API within the Do we:
I have no problem with them being separate, in reality a client shouldn't need to know what plugins are installed.... the features of interest should be in |
|
As APIs are currently registered at server start, they are effectively always enabled.
Overview:
Implement an
API
andServerPlugin interface method
to enable server features to be discovered by WebApps and plugins.Current State:
The server provides an HTTP endpoint /skServer/plugins to list information about the installed plugins on the server, but this endpoint requires the requestor to be authenticated (logged in) and limits a WebApp's ability to discover features supported by the serrver at start up.
Additionally there is currently no ability to retrieve a list of implemented APIs from the server.
Implementation:
This PR implements the following:
/signalk/v2/features
Plugin
interface method:app.getFeatures(enabled?: boolean)
The caller can request that:
enabled
are returneddisabled
are returnedExample requests:
Example: Return ALL features.
Example: Return only ENABLED features.
Example: Return only DISABLED features.
Example response:
Features Scope
All APIs implemented by the server.
All Plugins installed on the server